package cn.kgc.entity;

import java.util.ArrayList;
import java.util.Date;
import java.io.Serializable;
import java.util.List;

import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.*;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonFormat;

/**
 * 商品三级分类(PmsCategory)表实体类
 *
 * @author makejava
 * @since 2022-11-27 10:35:31
 */
@Setter
@Getter
@AllArgsConstructor
@NoArgsConstructor
@Builder
@TableName(value = "pms_category")
@SuppressWarnings("serial")
@JsonInclude(value = JsonInclude.Include.NON_NULL)
public class PmsCategory extends Model<PmsCategory> implements Serializable {

/*    //元素排序规则
    @Override
    public int compareTo(PmsCategory o) {
        return this.getSort()-o.getSort();
    }*/



    @TableId(type = IdType.AUTO)
    private Long id; //主键


    /**
     * 分类名称
     **/
    @TableField(value = "name")
    private String name;


    /**
     * 父分类id
     **/
    @TableField(value = "parent_cid")
    private Long parentCid;


    /**
     * 层级
     **/
    @TableField(value = "cat_level")
    private Integer catLevel;


    /**
     * 排序
     **/
    @TableField(value = "sort")
    private Integer sort;


    /**
     * 图标地址
     **/
    @TableField(value = "icon")
    private String icon;


    /**
     * 计量单位
     **/
    @TableField(value = "product_unit")
    private String productUnit;


    /**
     * 商品数量
     **/
    @TableField(value = "product_count")
    private Integer productCount;


    @TableLogic
    @JsonIgnore
    @TableField(fill = FieldFill.INSERT)
    private int deleted;  //逻辑删除标志


    @TableField(value = "creationDate", fill = FieldFill.INSERT)
    @JsonIgnore
    private Date creationDate; //创建时间


    @TableField(value = "modifyDate", fill = FieldFill.UPDATE)
    @JsonIgnore
    private Date modifyDate; //修改时间


    @Version
    private int version;   //版本

    @TableField(exist = false)
    private List<PmsCategory> pmsCategoryList=new ArrayList<>();

}
